package com.ruoyi.cmdb.service.impl;

import java.util.List;

import com.ruoyi.cmdb.util.GetId;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmdb.mapper.ResolutionMapper;
import com.ruoyi.cmdb.domain.Resolution;
import com.ruoyi.cmdb.service.IResolutionService;

/**
 * 解析Service业务层处理
 *
 * @author ruoyi
 * @date 2023-01-27
 */
@Service
public class ResolutionServiceImpl implements IResolutionService
{
    GetId getId=new GetId();//用这个类的方法生成当前时间的id
    @Autowired
    private ResolutionMapper resolutionMapper;

    /**
     * 查询解析
     *
     * @param id 解析主键
     * @return 解析
     */
    @Override
    public Resolution selectResolutionById(String id)
    {
        return resolutionMapper.selectResolutionById(id);
    }

    /**
     * 查询解析列表
     *
     * @param resolution 解析
     * @return 解析
     */
    @Override
    public List<Resolution> selectResolutionList(Resolution resolution)
    {
        return resolutionMapper.selectResolutionList(resolution);
    }

    /**
     * 新增解析
     *
     * @param resolution 解析
     * @return 结果
     */
    @Override
    public int insertResolution(Resolution resolution)
    {
        resolution.setId(getId.getTimeId());
        resolution.setCreateTime(DateUtils.getNowDate());
        return resolutionMapper.insertResolution(resolution);
    }

    /**
     * 修改解析
     *
     * @param resolution 解析
     * @return 结果
     */
    @Override
    public int updateResolution(Resolution resolution)
    {
        resolution.setUpdateTime(DateUtils.getNowDate());
        return resolutionMapper.updateResolution(resolution);
    }

    /**
     * 批量删除解析
     *
     * @param ids 需要删除的解析主键
     * @return 结果
     */
    @Override
    public int deleteResolutionByIds(String[] ids)
    {
        return resolutionMapper.deleteResolutionByIds(ids);
    }

    /**
     * 删除解析信息
     *
     * @param id 解析主键
     * @return 结果
     */
    @Override
    public int deleteResolutionById(String id)
    {
        return resolutionMapper.deleteResolutionById(id);
    }
}
